﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace 正儿半径的学习
{
    public static class Program
    {
        public static int f = 1;

        public static Dictionary<string, int> dww = new Dictionary<string, int>();

        public static int[][] arr = new int[][]  //四行3列
        {
            new int[] {1,2,3 },
            new int[] {4,5,6 },
            new int[] {7,8,9 },
            new int[] {10,11,12 }
        };
        
        public static void Main(string[] args)
        {
            //输出
            for(int i=0;i<arr.Length;i++)
            {
                for(int j=0;j<arr[i].Length;j++)
                {
                    Console.Write(arr[i][j] + " ");
                }
                Console.WriteLine();
            }

            dww.Add("a", 1);
            dww.Add("b", 2);
            dww.Add("c", 3);//添加键值对
            for(int i=0;i<dww.Count;i++)
            {
                Console.WriteLine(dww.Keys.ElementAt(i) + ":" + dww.Values.ElementAt(i));
            }
            dww.Remove("b");
            for (int i = 0; i < dww.Count; i++)
            {
                Console.WriteLine(dww.Keys.ElementAt(i) + ":" + dww.Values.ElementAt(i));
            }
            Console.WriteLine("===========================================");
            foreach (var KEE in dww) //遍历字典
            {
                Console.WriteLine(KEE.Key + ":" + KEE.Value);//输出键值对
            }
            int d = 0;
            gg(ref d);      
            
            Type t = typeof(Program);
            Console.WriteLine(t.Name);
            Console.WriteLine(t.Namespace);
            string ds = (t.ContainsGenericParameters).ToString();
            Console.WriteLine(ds);
            Console.WriteLine("输入三个数 用空格隔开");
            bool k = true;
            while (k)
            {
                 k = false;
                try
                {
                    string str = Console.ReadLine();
                    string[] strs = str.Split(' ');
                    int? a = int.Parse(strs[0]);
                    int? b = int.Parse(strs[1]);
                    int? c = int.Parse(strs[2]);
                    Console.WriteLine($"{a} {b} {c}");
                }
                catch (Exception)
                {
                    Console.WriteLine("输入有误，请重新输入");
                    k = true;
                }              
            }

        }

        public static int gg(ref int i)//递归函数
        {
            Console.WriteLine(i);
            if (i >= 10)
            {
                return i;
            }
            else
            {
                i++;
                gg1(ref i);
                return i;
            }
        }
        public static void gg1(ref int i)//递归函数
        {
            i+=2;
            gg(ref i);
        }
    }
}
